#include<bits/stdc++.h>

using namespace std;

struct node	//双链表
{
	int num = 0;
	node *next=NULL,*pre=NULL;
};

map<int,node*>mp;

void remove(node *p){	//删除节点
	p->pre->next = p->next;
	if(p->next!=NULL)p->next->pre = p->pre;
}

void insert(node *pre,node *p,node *next){	//插入节点
	pre->next = p;
	p->pre = pre;
	p->next = next;
	if(next!=NULL)next->pre = p;
}

int main(){
	int n;scanf("%d", &n);
	node *root =new node(),*pre = root;
	for (int i = 1; i < n+1; ++i)
	{
		node *stu = new node();
		stu->num = i;
		mp[i]=stu;
		insert(pre,stu,NULL);
		pre = stu;
	}
	int m;scanf("%d", &m);
	for (int i = 0; i < m; ++i)
	{
		int p,q;scanf("%d%d",&p,&q);
		node *stu = mp[p],*pos =stu;
		remove(stu);
		if(q>0){
			while(q>0){
				pos = pos->next;
				--q;
			}
			insert(pos,stu,pos->next);
		}else{
			while(q<0){
				pos = pos->pre;
				++q;
			}
			insert(pos->pre,stu,pos);
		}
	}
	node *pos = root->next;
	printf("%d", pos->num);
	pos = pos->next;
	while(pos!=NULL){
		printf(" %d", pos->num);
		pos = pos->next;
	}
	printf("\n");

	return 0;
}